<template>
	<view class="work-content">
		<view class="search">
			<uni-easyinput suffixIcon="search" placeholder="请输入圈子名称" v-model="circleName"
				@iconClick="getCircleData"></uni-easyinput>
		</view>
		<view class="content-list" v-for="item in dataList" @click="handleClick(item)">
			<view class="head-bar">
				<u--image :showLoading="true" :src="imgUrl+item.accessory" width="80px" height="80px"></u--image>
				<view class="right">
					<view class="title">{{item.title}}</view>
					<view class="text">{{item.content}}</view>
				</view>
			</view>
			<view class="foot-bar">
				<view class="left">{{item.create_user}}</view>
				<view class="right">
					<view class="text">主题：{{item.theme_num}}个</view>
					<view class="text">成员：{{item.group_num}}个</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import config from '@/config'
	import {
		getCircle
	} from '@/api/work'
	export default {
		data() {
			return {
				imgUrl: config.imgUrl,
				dataList: [],
				circleName: "",
			}
		},
		created() {
			this.getCircleData();
		},
		methods: {
			handleClick(item) {
				this.$tab.navigateTo(`/pages/work/circleDetails?themeId=` + item.id)
			},
			getCircleData() {
				getCircle({
					name: this.circleName,
					deviceId: this.$store.state.user.deviceId
				}).then(res => {
					this.dataList = res.list;
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #ddd;
	}

	.work-content {
		.search {
			background: #fff;
			padding: 5px 15px;
		}

		.content-list {
			background: #fff;
			padding: 10px 10px 0;
			margin: 10px;

			.head-bar {
				display: flex;
				align-items: center;

				.right {
					margin-left: 15px;

					.title {
						font-size: 20px;
						color: #666;
					}

					.text {
						font-size: 14px;
						color: #999;
					}
				}
			}

			.foot-bar {
				display: flex;
				background: #fff;
				justify-content: space-between;
				margin: 10px -10px;
				padding: 5px 10px;
				border-top: 1px solid #eee;

				.left {
					color: #999;
					font-size: 14px;
				}

				.right {
					display: flex;
					align-items: center;

					.text {
						color: #666;
						margin: 0 5px;
						font-size: 14px;
					}
				}
			}
		}
	}
</style>